package com.lingxu.api.ztb.controller;


import com.lingxu.api.ztb.service.ISjcsJgysb1Service;
import com.lingxu.api.ztb.model.SjcsJgysb1;
import com.lingxu.api.ztb.model.vo.SjcsJgysb1VO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import com.lingxu.base.common.api.vo.Result;
import com.lingxu.base.common.api.vo.ResultOne;
import com.lingxu.base.common.annotation.Encrypt;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
 * 交工验收表 前端控制器
 *
 * @author admin
 * @since 2025-11-07
 */
@Slf4j
@Api(tags = "交工验收表", value = "SjcsJgysb1Controller")
@Validated
@CrossOrigin
@RestController
@RequestMapping("/sjcsJgysb1")
public class SjcsJgysb1Controller {

    @Autowired
    private ISjcsJgysb1Service  sjcsJgysb1Service;

    /**
    * 分页查询
    *
    * @param query
    * @return
    */
    @ApiOperation(value="交工验收表列表")
    @PostMapping(value = "/list")
    public ResultOne<SjcsJgysb1VO> queryPageList(@RequestBody SjcsJgysb1VO query) {
        return ResultOne.ok(sjcsJgysb1Service.queryPageList(query));
    }

    /**
     * 保存
     *
     * @param vo
     * @return
     */
    @ApiOperation(value = "交工验收表新增")
    @PutMapping(value = "/add")
    public Result<?> add(@Encrypt @RequestBody SjcsJgysb1 vo) {
        sjcsJgysb1Service.save(vo);
        return Result.ok("添加成功！");
    }

    /**
    * 修改
    *
    * @param vo
    * @return
    */
    @ApiOperation(value = "交工验收表修改")
    @PostMapping(value = "/edit")
    public Result<?> edit(@Encrypt @RequestBody SjcsJgysb1 vo) {
        sjcsJgysb1Service.updateById(vo);
        return Result.ok("编辑成功!");
    }

    /**
     * 查询详情
     *
     * @param id
     * @return
     */
    @ApiOperation(value = "交工验收表查询详情")
    @GetMapping("/get")
    public Result<SjcsJgysb1VO> get(@RequestParam String id){
        return  Result.ok(sjcsJgysb1Service.getById(id));
    }

    /**
     * 删除
     *
     * @param ids
     * @return
     */
    @ApiOperation(value = "删除")
    @PostMapping(value = "/delete")
    public Result<String> delete(@Encrypt @RequestBody Set<String> ids){
        sjcsJgysb1Service.delete(ids);
        return Result.ok("删除成功!");
    }

}